import java.io.*;
import java.net.*;
import java.util.*;

public class Server_2 {
    public static void main(String[] args) {
        ServerSocket Server_2forClient_2=null;
        Socket SocketOnServer_2=null;
        DataOutputStream Server_2out=null;
        DataInputStream Server_2in=null;
        try {
            Server_2forClient_2=new ServerSocket(5353);
        }
        catch (IOException e1) {
            System.out.println(e1);
            //e1.printStackTrace();
        }
        try {
            System.out.println("等待客户端呼叫……");
            SocketOnServer_2=Server_2forClient_2.accept();
            Server_2out=new DataOutputStream(SocketOnServer_2.getOutputStream());
            Server_2in=new DataInputStream(SocketOnServer_2.getInputStream());
            String expr=Server_2in.readUTF();
            System.out.println("服务器接收到表达式："+expr);
            int result;
            MyBC mybc=new MyBC();
            result=mybc.evaluate(expr);
            String ss=" "+"21";
            Server_2out.writeUTF("后缀表达式:"+expr+"，运算结果为："+ss);
            Thread.sleep(50000);
        }
        catch (Exception e2) {
            System.out.println("客户端已断开"+e2);
        }
    }
}